package com.example.test.实体责任链;

import com.example.test.bean.User;

public class HandelChain {

    private AbstractHandel header;

    private AbstractHandel temp;

    public void addHandel(AbstractHandel abstractHandel){

        if (header==null) {
            header = abstractHandel;
            temp = abstractHandel;
            return;
        }

        temp.setNextHandel(abstractHandel);
        temp = abstractHandel;
    }

    public void doHandel(User user){
        if (header !=null) {
            header.handel(user);
        }
    }

}
